package cn.dm.item.client;

import cn.dm.client.RestDmImageClient;
import cn.dm.client.RestDmItemTypeClient;
import cn.dm.common.EmptyUtils;
import cn.dm.mapper.DmItemTypeMapper;
import cn.dm.pojo.DmImage;
import cn.dm.pojo.DmItemType;
import cn.dm.vo.DmItemTypeVo;
import cn.dm.vo.HotItemVo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
public class DmItemTypeService {
    @Resource
    private DmItemTypeMapper dmItemTypeMapper;

    @RequestMapping(value = "/getDmItemTypeById",method = RequestMethod.POST)
    public DmItemType getDmItemTypeById(@RequestParam("id") Long id)throws Exception{
        return dmItemTypeMapper.getDmItemTypeById(id);
    }

    @RequestMapping(value = "/getDmItemTypeListByMap",method = RequestMethod.POST)
    public List<DmItemType>	getDmItemTypeListByMap(@RequestBody Map<String, Object> param)throws Exception{
        return dmItemTypeMapper.getDmItemTypeListByMap(param);
    }

    @RequestMapping(value = "/getDmItemTypeCountByMap",method = RequestMethod.POST)
    public Integer getDmItemTypeCountByMap(@RequestBody Map<String, Object> param)throws Exception{
        return dmItemTypeMapper.getDmItemTypeCountByMap(param);
    }

    @RequestMapping(value = "/qdtxAddDmItemType",method = RequestMethod.POST)
    public Integer qdtxAddDmItemType(@RequestBody DmItemType dmItemType)throws Exception{
        return dmItemTypeMapper.insertDmItemType(dmItemType);
    }

    @RequestMapping(value = "/qdtxModifyDmItemType",method = RequestMethod.POST)
    public Integer qdtxModifyDmItemType(@RequestBody DmItemType dmItemType)throws Exception{
        return dmItemTypeMapper.updateDmItemType(dmItemType);
    }




    @RequestMapping(value = "/selectTestChildren",method = RequestMethod.POST)
    public List<DmItemTypeVo>	getTypeWithHotItem()throws Exception{
        List<DmItemTypeVo> list = dmItemTypeMapper.selectTestChildren();


        return list;


    }

}
